package com.transsion.clouddemo.core.Custom.utils


object Constants {

    const val SCENE_CONTACTS: String = "1"  //通讯录
    const val SCENE_CONTACT_GROUP: String = "2"  //联系人群组
    const val SCENE_BLOCK_NUMBERS: String = "3"    //黑名单
    const val SCENE_NOTEPAD: String = "4"  //记事
    const val SCENE_CALENDAR: String = "5"  //日历
    const val SCENE_SPORTS_HEALTH: String = "6"  //运动健康
    const val SCENE_WLAN_CODE: String = "7"  //WLAN
    const val SCENE_WALLPAPER_CODE: String = "10"  //壁纸
    const val SCENE_CLOUD: String = "9"  //云服务



    const val SCENE_WALLPAPER = "wallpaper"  //壁纸

    const val SCENE_CALL_LOG = "callLog"
    const val SCENE_LAYOUT = "layout"
    const val SCENE_SETTING = "setting"
    const val SCENE_APK = "apk"
    const val SCENE_SMS = "sms"
    const val RECYCLE_BIN_DATA_RETENTION_TIME = "RECYCLE_BIN_DATA_RETENTION_TIME"

    //暂停
    const val ERROR_REQUEST_PAUSE = 1
    //取消
    const val ERROR_REQUEST_CANCEL = 2
    //请求报错
    const val ERROR_REQUEST_FAILED = -1
    //没有token
    const val ERROR_REQUEST_NEED_TOKEN = 3
    //没有请求数据
    const val ERROR_REQUEST_NO_DATA = 4

    //无需上传，云端已存在
    const val ERROR_REQUEST_HAS_FILE = 5
    //内存不足
    const val ERROR_DOWNLOAD_STORAGE_FULL = 20
    //云空间已满
    const val ERROR_CLOUD_STORAGE_FULL = 21

    private val APPID_SCENE_MAP = mapOf(
        "phone-contact" to SCENE_CONTACTS,
        "blocknums" to SCENE_BLOCK_NUMBERS,
        "notebook" to SCENE_NOTEPAD,
        "calendar" to SCENE_CALENDAR,
        "healthlife" to SCENE_SPORTS_HEALTH,
        "wlan" to SCENE_WLAN_CODE
    )

//    fun getSceneTypeResId(scene: String): Int? {
//        when (scene) {
//            SCENE_CONTACTS -> {
//                return R.string.common_scene_contacts
//            }
//
//            SCENE_CONTACT_GROUP -> {
//                return R.string.common_contact_group
//            }
//
//            SCENE_BLOCK_NUMBERS -> {
//                return R.string.common_block_numbers
//            }
//
//            SCENE_NOTEPAD -> {
//                return R.string.common_notepad
//            }
//
//            SCENE_CALENDAR -> {
//                return R.string.common_calendar
//            }
//
//            SCENE_SPORTS_HEALTH -> {
//                return R.string.common_sports_health
//            }
//
//            SCENE_WLAN_CODE -> {
//                return R.string.common_wlan
//            }
//
//            else -> {
//                return null
//            }
//        }
//    }

    const val CONTACTS_PACKAGE_NAME = "com.sh.smart.caller"
    const val WLAN_PACKAGE_NAME = "com.transsion.cloudserver"
    const val BLOCK_NUMBERS_NAME = "com.android.phone"
    const val NOTEBOOK_PACKAGE_NAME = "com.transsion.notebook"
    const val HEALTH_LIFE_PACKAGE_NAME = "com.transsion.healthlife"
    const val CALENDAR_PACKAGE_NAME = "com.transsion.calendar"
    const val CLOUD_DEMO = "com.transsion.clouddemo"


    fun getScenePackName(scene: String): String? {
        return when (scene) {
            SCENE_CONTACTS, SCENE_CONTACT_GROUP  -> {
                CONTACTS_PACKAGE_NAME
            }
            SCENE_BLOCK_NUMBERS ->{
                BLOCK_NUMBERS_NAME
            }
            SCENE_NOTEPAD -> {
                NOTEBOOK_PACKAGE_NAME
            }

            SCENE_CALENDAR -> {
                CALENDAR_PACKAGE_NAME
            }

            SCENE_SPORTS_HEALTH -> {
                HEALTH_LIFE_PACKAGE_NAME
            }

            SCENE_WLAN_CODE -> {
                WLAN_PACKAGE_NAME
            }
            SCENE_CLOUD->{
                CLOUD_DEMO
            }
            else -> {
                return null
            }
        }
    }

    fun getSceneByAppId(appId: String): String? {
        return APPID_SCENE_MAP[appId]
    }

    fun getAppIdByScene(scene: String): String? {
        return APPID_SCENE_MAP.keys.firstOrNull { APPID_SCENE_MAP[it] == scene }
    }

}